package hxg.课程表;

import java.util.Scanner;

/**
 * @author HeXiangGuang
 * @create 2022-10-19 16:34
 * 姓名   星期  课程开始 课程结束   课程名
 * 张三   星期一 8:00    8:45    语文
 * 张三   星期一 9:00    9:45    数学
 * 张三   星期三 14:30   15:15   体育
 * 张三   星期二 11:00   11:45   美术
 * 张三   星期五 13:00   14:45   英语
 * 星期一 Monday 简写为Mon
 *
 * 　　星期二 Tuesday 简写为Tue
 *
 * 　　星期三 Wednesday 简写为Wed
 *
 * 　　星期四 Thursday 简写为Thu
 *
 * 　　星期五 Friday 简写为Fri
 *
 * 　　星期六 Saturday 简写为Sat
 *
 * 　　星期日 Sunday 简写为Sun
 */
public class SchoolTimetable {
    public static void main(String[] args) {

        //定义要输出的变量
        String Mon01 ="    ",Mon02 ="    ",Mon03 ="    ",Mon04 ="    "
                ,Mon05 ="    ",Mon06 ="    ",Mon07 ="    ",Mon08 ="    ";
        String Tue01 ="    ",Tue02 ="    ",Tue03 ="    ",Tue04 ="    "
                ,Tue05 ="    ",Tue06 ="    ",Tue07 ="    ",Tue08 ="    ";
        String Wed01 ="    ",Wed02 ="    ",Wed03 ="    ",Wed04 ="    "
                ,Wed05 ="    ",Wed06 ="    ",Wed07 ="    ",Wed08 ="    ";
        String Thu01 ="    ",Thu02 ="    ",Thu03 ="    ",Thu04 ="    "
                ,Thu05 ="    ",Thu06 ="    ",Thu07 ="    ",Thu08 ="    ";
        String Fri01 ="    ",Fri02 ="    ",Fri03 ="    ",Fri04 ="    "
                ,Fri05 ="    ",Fri06 ="    ",Fri07 ="    ",Fri08 ="    ";
        Scanner input = new Scanner(System.in);
        Boolean flag = true;
        System.out.println("请输入姓名：");
        String name = input.nextLine();
        while (flag){
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入星期：");
            String week = sc.nextLine();
            System.out.println("请输入课程开始时间：");
            String[] startTimetx = sc.nextLine().split(":", 2);
            int startHour = Integer.parseInt(startTimetx[0]);
            int startMinute = Integer.parseInt(startTimetx[1]);
            System.out.println("请输入课程结束时间：");
            String[] endTimetx = sc.nextLine().split(":", 2);
            int endHour = Integer.parseInt(endTimetx[0]);
            int endMinute = Integer.parseInt(endTimetx[1]);
            System.out.println("请输入课程姓名：");
            String courseName = sc.nextLine();
            switch (week){
                case "星期一":
                    switch (startHour){
                        case 8:
                            Mon01 = courseName;
                            break;
                        case 9:
                            Mon02 = courseName;
                            break;
                        case 10:
                            Mon03 = courseName;
                            break;
                        case 11:
                            Mon04 = courseName;
                            break;
                        case 13:
                            Mon05 = courseName;
                            break;
                        case 14:
                            Mon06 = courseName;
                            break;
                        case 15:
                            Mon07 = courseName;
                            break;
                        case 16:
                            Mon08 = courseName;
                            break;
                        default:
                            System.out.println("startHour错误");
                            break;
                    }
                    break;
                case "星期二":
                    switch (startHour){
                        case 8:
                            Tue01 = courseName;
                            break;
                        case 9:
                            Tue02 = courseName;
                            break;
                        case 10:
                            Tue03 = courseName;
                            break;
                        case 11:
                            Tue04 = courseName;
                            break;
                        case 13:
                            Tue05 = courseName;
                            break;
                        case 14:
                            Tue06 = courseName;
                            break;
                        case 15:
                            Tue07 = courseName;
                            break;
                        case 16:
                            Tue08 = courseName;
                            break;
                        default:
                            System.out.println("startHour错误");
                            break;
                    }
                    break;
                case "星期三":
                    switch (startHour){
                        case 8:
                            Wed01 = courseName;
                            break;
                        case 9:
                            Wed02 = courseName;
                            break;
                        case 10:
                            Wed03 = courseName;
                            break;
                        case 11:
                            Wed04 = courseName;
                            break;
                        case 13:
                            Wed05 = courseName;
                            break;
                        case 14:
                            Wed06 = courseName;
                            break;
                        case 15:
                            Wed07 = courseName;
                            break;
                        case 16:
                            Wed08 = courseName;
                            break;
                        default:
                            System.out.println("startHour错误");
                            break;
                    }
                    break;
                case "星期四":
                    switch (startHour){
                        case 8:
                            Thu01 = courseName;
                            break;
                        case 9:
                            Thu02 = courseName;
                            break;
                        case 10:
                            Thu03 = courseName;
                            break;
                        case 11:
                            Thu04 = courseName;
                            break;
                        case 13:
                            Thu05 = courseName;
                            break;
                        case 14:
                            Thu06 = courseName;
                            break;
                        case 15:
                            Thu07 = courseName;
                            break;
                        case 16:
                            Thu08 = courseName;
                            break;
                        default:
                            System.out.println("startHour错误");
                            break;
                    }
                    break;
                case "星期五":
                    switch (startHour){
                        case 8:
                            Fri01 = courseName;
                            break;
                        case 9:
                            Fri02 = courseName;
                            break;
                        case 10:
                            Fri03 = courseName;
                            break;
                        case 11:
                            Fri04 = courseName;
                            break;
                        case 13:
                            Fri05 = courseName;
                            break;
                        case 14:
                            Fri06 = courseName;
                            break;
                        case 15:
                            Fri07 = courseName;
                            break;
                        case 16:
                            Fri08 = courseName;
                            break;
                        default:
                            System.out.println("startHour错误");
                            break;
                    }
                    break;
                default:
                    System.out.println("日期输入错误");
                    break;

            }
            //控制输入
            System.out.println("是否继续输入课程信息？是输入0,否输入1程序结束");
            int index = input.nextInt();
            if (index ==1){
                flag = false;
            }
        }
        System.out.println(name+"的课程表如下:");
        System.out.println("            上午              下午");
        System.out.println("星期一"+"\t"+Mon01+" "+Mon02+" "+Mon03+" "
                +Mon04+" "+Mon05+" "+Mon06+" "+Mon07+" "+Mon08);
        System.out.println("星期二"+"\t"+Tue01+" "+Tue02+" "+Tue03+" "
                +Tue04+" "+Tue05+" "+Tue06+" "+Tue07+" "+Tue08);
        System.out.println("星期三"+"\t"+Wed01+" "+Wed02+" "+Wed03+" "
                +Wed04+" "+Wed05+" "+Wed06+" "+Wed07+" "+Wed08);
        System.out.println("星期四"+"\t"+ Thu01+" "+ Thu02+" "+ Thu03+" "
                + Thu04+" "+ Thu05+" "+ Thu06+" "+ Thu07+" "+ Thu08);
        System.out.println("星期五"+"\t"+Fri01+" "+Fri02+" "+Fri03+" "
                +Fri04+" "+Fri05+" "+Fri06+" "+Fri07+" "+Fri08);
    }
}
